All Questions
Tagged with scalaerror-handling
13 questions
1vote
1answer
44views
Page download with reattempts in Scala
I wrote the following code to deal with possible network problems. ...
0votes
1answer
79views
Report a status based on a list of results
In one of my services, I have the function as presented below: ...
1vote
1answer
150views
Parsing latitude and longitude, using Try[T] to ignore errors
I wrote this question asking about how to implement my error handling while still maintaining functional code and based on 200_success's very interesting note on the spaces, I decided to ...
1vote
1answer
220views
Implementation of API to create a company account in a database
I'm working on an API that has a lot of controller functions like this: ...
2votes
1answer
51views
Pushing data to an analytics API
This is code that handles pushing data to an analytics API, and IMO it feels too much like Java. logActivity is a method that uses ...
2votes
1answer
98views
Print Trace Debugger
Notice: The original library has since been replaced by: https://github.com/JohnReedLOL/scala-trace-debug See my Scala print trace debugger. This project is used for lightweight debugging sort of ...
3votes
1answer
2kviews
Playframework (Scala) custom exception handling
I am using play framework with scala and here is a scenario on which I would like to have your opinion. Let's say I have 2 ...
3votes
2answers
285views
2votes
2answers
2kviews
Branching with multiple Try
I have a series of four method calls that all return Try[Something], with the last returning Try[Unit]. Something like this: ...
8votes
2answers
906views
Idiomatic Scala try option code block
Basically, this function returns a list of flights for an airline. But if the airline doesn't exist, I want to throw some custom runtime exception. If that airline does exist, I want to return a list ...
3votes
2answers
348views
Adding two values in a map, if they exist
My code looks like imperative style code. I want to make my code more functional. How I can rewrite my program so it become functional style code? ...
7votes
2answers
7kviews
Handling parsing failure in Scala without exceptions
I have a Scala (Play!) application that must get and parse some data in JSON from an external service. I want to be able to gently handle failure in the response format, but it is becoming messy. What ...
6votes
3answers
3kviews
A safer way to cut a string
I want to get just the first line of a big string. Currently, here's how I do it: ...